<?php if(!defined('BASEPATH')) exit('No direct script allowed');

class mdl_merk_kendaraan extends CI_Model{
	
	function __construct()
	{
		parent::__construct();
	}
	
	function getItem($num=0, $offset=0)
	{		if(!$num){$num=0;}		if(!$offset){$offset=0;}		/*
		$this->db->flush_cache();
		$this->db->select('t_merk_kb.*');
		$this->db->from('t_merk_kb');  
		$this->db->order_by("kode", "asc");
		$this->db->limit($offset, $num); 		return $this->db->get();		*/ 				$sql = "select  * 				from t_merk_kb 				"; 				$this->db->flush_cache();		return $this->db->query($sql);				}
	
	function getItemById($kode)
	{
		$this->db->flush_cache();
		$this->db->select('t_merk_kb.*');
		$this->db->from('t_merk_kb');
		$this->db->where('t_merk_kb.kd_merek_kb', $kode);
		return $this->db->get();
	}

	function insert($data)
	{
		$this->db->flush_cache();
		$this->db->insert('t_merk_kb', $data);
	}
	
	function update($kode, $data)
	{
		$this->db->flush_cache();
		$this->db->where('kd_merek_kb', $kode);
		$this->db->update('t_merk_kb', $data);
	}
	
	function delete($kode)
	{
		$this->db->flush_cache();
		$this->db->delete('t_merk_kb', array('kd_merek_kb' => $kode));		
	}
		function getAll()	{		$this->db->flush_cache();		$this->db->select('t_merk_kb.*');		$this->db->from('t_merk_kb');  		$this->db->order_by("kd_merek_kb", "asc"); 		return $this->db->get();		}  
}